package com.jjs.jcenterdemo.adapterhelper;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;

import com.flyco.tablayout.CommonTabLayout;
import com.flyco.tablayout.SlidingTabLayout;
import com.jjs.jcenterdemo.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class QqSimulateActivity extends AppCompatActivity
{

    @BindView(R.id.tab)
    SlidingTabLayout tab;
    @BindView(R.id.pager)
    ViewPager pager;

    private static final String[] tabs = {"全部", "手工", "禅绕画", "动漫插画","全部", "手工", "禅绕画", "动漫插画","全部", "手工", "禅绕画", "动漫插画"};

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_qq_simulate);
        ButterKnife.bind(this);
        pager.setAdapter(new Ad(getSupportFragmentManager()));
        tab.setViewPager(pager);
    }

    class Ad extends FragmentStatePagerAdapter
    {

        public Ad(FragmentManager fm)
        {
            super(fm);
        }

        @Override
        public CharSequence getPageTitle(int position)
        {
            return tabs[position];
        }

        @Override
        public Fragment getItem(int position)
        {
            return new QqFragment();
        }

        @Override
        public int getCount()
        {
            return tabs.length;
        }
    }
}
